<template>
  <el-table-column v-bind="$attrs" min-width="120" show-overflow-tooltip>
    <template #default="{ row }">
      <div v-if="!isEdit">{{ row[prop] }}</div>
      <el-select v-model="row[prop]" clearable placeholder="" v-else>
        <el-option v-for="item in basEnumList" :key="item.code" :value="item.code" :label="item.code"
          :disabled="!item.isEnabled" />
      </el-select>
    </template>
  </el-table-column>
</template>
<script lang="ts" setup>
// 表格内可编辑的枚举选择框，用于表格内的枚举选择框，例如：
// <MkColumnInputEnum enumType="ABOYueXue" prop="chuShaiABO" label="ABO血型" :isEdit="ctx.isEdit" />
import { getEnumItemsByType } from '/@/stores/baseInfo/'

defineOptions({
  name: 'MkColumnInputEnum',
});

const props = defineProps({
  prop: {
    type: String,
    require: true,
    default: 'id'
  },
  isEdit: {
    type: Boolean,
    default: false,
  },
  enumType: {
    type: String,
    default: '',
    require: true,
  },
})

const basEnumList = getEnumItemsByType(props.enumType);
</script>
